﻿using Dora.Tools.Enums.AdminUser;
using Dora.Tools.Utility;
using System;
using System.Collections.Generic;
using System.Text;

namespace Dora.Services.AdminUser.Dto.ViewDto
{
    /// <summary>
    /// 组织机构短信发送统计dto
    /// </summary>
    public class SmsRecordOrgStaticsViewDto
    {
        /// <summary>
        /// 组织机构Id
        /// </summary>
        public int OrgId { get; set; }

        /// <summary>
        /// 机构级别;组织机构级别 0：总（大）社，1：分社，2：门店，3：直属门店，4：直属部门。
        /// </summary>
        public int OLevel { get; set; }

        /// <summary>
        /// 机构类别 0：总（大）社，1：直属门店 2：分销商，3：直属部门
        /// </summary>
        public int OType { get; set; }

        /// <summary>
        /// 组织机构名称
        /// </summary>
        public string OrgName { get; set; }

        /// <summary>
        /// 短信发送数量
        /// </summary>
        public int SmsCount { get; set; }

        /// <summary>
        /// 组织机构类型文本
        /// 参考枚举 PermissionOrgType
        /// </summary>
        public string OrgPTypeText
        {
            get
            {
                var text = "";
                //大社
                if (OType == (int)OrgType.General && OLevel == (int)OrgLevel.Master)
                    text = PermissionOrgType.BigTravelAgency.ToDescription();
                //直属门店
                else if (OType == (int)OrgType.DirectlyUnder && OLevel == (int)OrgLevel.DirectlyUnder)
                    text = PermissionOrgType.DirectShop.ToDescription();
                //分销商
                else if (OType == (int)OrgType.Distributor)
                {
                    //分社
                    if (OLevel == (int)OrgLevel.Branch)
                        text = PermissionOrgType.SubTravelAgency.ToDescription();
                    //门店
                    else if (OLevel == (int)OrgLevel.Store)
                        text = PermissionOrgType.Shop.ToDescription();
                }
                return text;
            }
        }
    }
}
